<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>    
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<html>
<head>

 <link href="<c:url value="/resources/homepage.css" />" rel="stylesheet">
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Login Page</title>
<script type="text/javascript">
function validateform()
{
	
	var letters = /^[A-Za-z]+$/; 
	var st=document.forms.myform.first_name.value;
	var sd=document.forms.myform.password.value;
	
	if(st==null || st=="" || (!isNaN(st)))
		{
			alert("Username cannot be empty");
			//return false;
		}
	if(!(st.value.match(letters)))  
    {  
		alert("Username cannot have numbers"); 
    } 


	if(sd==null || sd=="")
	{
		alert("Password cannot be empty");
		//return false;
	}	
}

</script>

</head>
<body>
<div id="wrapper">
		<!-- ============ HEADER SECTION ============== -->
		<div id="header">
			<div id="headerlogo"></div>
		</div>
		<div id="m1">
		<br>
		<br><br><br>
		<center>
		<form:form name="myform" action="validate" method="post" modelAttribute="employee" onsubmit="return validateform();">
		<label>UserName</label>
		<form:input path="first_name"/><br><br>
		<label>Password</label>
		<form:input  path="password" type="password"/>
<br><br>
		
			
						<select name="roleId">
	<c:forEach var="role" items="${listRole}">
	<option value='<c:out value="${role.roleId}"/>'>
	<c:out value="${role.roleName}" />
	</option>
	</c:forEach>
</select><br>
<font color="red">${error}</font>
		
		<br><br>
        	<input type="submit" value="Login"/>
    </form:form>
    </center>
    </div>
    </div>
</body>
</html>